home *** CD-ROM | disk | FTP | other *** search
/ PC Shareware 1997 February / PC Shareware 1997-02.iso / programy / envlp122 / envelop.5 / Tools / Arsenal / parts / pictclip / pictclip.eto < prev    next >
Text File  |  1996-03-15  |  6KB  |  210 lines

  1. Type PictClipMasterForm From SampleMasterForm
  2.   Dim sbrNavigator As New ScrollBar
  3.   Dim Label1 As New Label
  4.   Dim imgCropDisplay As New Image
  5.   Dim imgFullDisplay As New Image
  6.   Dim bmpIcons As New Bitmap
  7.   Dim picOutline As New MarkupLayer
  8.  
  9.   ' METHODS for object: PictClipMasterForm
  10.   Sub Convert2RowColumn(x As Single, y As Single)
  11.     Dim image_width As Integer
  12.     Dim image_height As Integer
  13.     Dim row_height As Integer
  14.     Dim column_width As Integer
  15.   
  16.     Dim column As Integer
  17.     Dim row As Integer
  18.   
  19.     Dim row_val As Integer
  20.     Dim col_val As Integer
  21.   
  22.     ' We need to move the display box to the right icon location
  23.     image_width = imgFullDisplay.Width
  24.     image_height = imgFullDisplay.Height
  25.   
  26.     row_height = image_height / 13
  27.     column_width = image_width / 12
  28.   
  29.     column = x / column_width
  30.     row = y / row_height
  31.   
  32.     ' Need to convert row/column values into scrollbar values 1-156
  33.     ' Debug.Print row, column
  34.     row_val = row * 12
  35.     col_val = column + 1
  36.     sbrNavigator.Value = row_val + col_val
  37.   End Sub
  38.  
  39.   Sub DisplayIcon(icon_number As Integer)
  40.   
  41.     Dim row As Integer
  42.     Dim column As Integer
  43.   
  44.     Dim x_offset As Integer
  45.     Dim y_offset As Integer
  46.   
  47.     ' Used to update the display of the icon
  48.     ' as well as update the location of the highlight box
  49.   
  50.     Select Case icon_number
  51.       Case 1 To 12
  52.         row = 1
  53.         column = icon_number
  54.       Case 13 To 24
  55.         row = 2
  56.         column = icon_number - 12
  57.       Case 25 To 36
  58.         row = 3
  59.         column = icon_number - 24
  60.       Case 37 To 48
  61.         row = 4
  62.         column = icon_number - 36
  63.       Case 49 To 60
  64.         row = 5
  65.         column = icon_number - 48
  66.       Case 61 To 72
  67.         row = 6
  68.         column = icon_number - 60
  69.       Case 73 To 84
  70.         row = 7
  71.         column = icon_number - 72
  72.       Case 85 To 96
  73.         row = 8
  74.         column = icon_number - 84
  75.       Case 97 To 108
  76.         row = 9
  77.         column = icon_number - 96
  78.       Case 109 To 120
  79.         row = 10
  80.         column = icon_number - 108
  81.       Case 121 To 132
  82.         row = 11
  83.         column = icon_number - 120
  84.       Case 133 To 144
  85.         row = 12
  86.         column = icon_number - 132
  87.       Case 145 To 156
  88.         row = 13
  89.         column = icon_number - 144
  90.     End Select
  91.   
  92.     x_offset = (column - 1) * 24
  93.     y_offset = (row - 1) * 22
  94.   
  95.     imgCropDisplay.CropXOffset = x_offset
  96.     imgCropDisplay.CropYOffset = y_offset
  97.   
  98.     ' Move the highlight box according to the offset values
  99.     MoveDisplayBox(row, column)
  100.   
  101.     imgCropDisplay.Refresh
  102.     sbrNavigator.Refresh
  103.   
  104.   End Sub
  105.  
  106.   Sub imgFullDisplay_MouseDown(button As Integer, shift As Integer, x As Single, y As Single)
  107.     Convert2RowColumn(x, y)
  108.   End Sub
  109.  
  110.   Sub MoveDisplayBox(row As Integer, column As Integer)
  111.     Dim x_zero As Integer
  112.     Dim y_zero As Integer
  113.     Dim image_width As Integer
  114.     Dim image_height As Integer
  115.     Dim row_height As Integer
  116.     Dim column_width As Integer
  117.   
  118.     ' We need to move the display box to the right icon location
  119.     x_zero = imgFullDisplay.Left
  120.     y_zero = imgFullDisplay.Top
  121.     image_width = imgFullDisplay.Width
  122.     image_height = imgFullDisplay.Height
  123.   
  124.     row_height = image_height / 13
  125.     column_width = image_width / 12
  126.   
  127.     picOutline.Width = column_width + picOutline.BevelWidth * Screen.TwipsPerPixelX * 2
  128.     picOutline.Height = row_height + picOutline.BevelWidth * Screen.TwipsPerPixelY * 2
  129.   
  130.     picOutline.Left = x_zero + ((column - 1) * column_width) - picOutline.BevelWidth * Screen.TwipsPerPixelX
  131.     picOutline.Top = y_zero + ((row - 1) * row_height) - picOutline.BevelWidth * Screen.TwipsPerPixelY
  132.   
  133.     picOutline.Refresh
  134.   End Sub
  135.  
  136.   Sub ResetApplication_Click()
  137.     imgCropDisplay.ScaleX = 1
  138.     imgCropDisplay.ScaleY = 1
  139.     imgCropDisplay.Refresh
  140.   End Sub
  141.  
  142.   Sub sbrNavigator_Change()
  143.     DisplayIcon(sbrNavigator.Value)
  144.   End Sub
  145.  
  146. End Type
  147.  
  148. Begin Code
  149. ' Reconstruction commands for object: PictClipMasterForm
  150. '
  151.   With PictClipMasterForm
  152.     .TextPreLoad()
  153.     .Caption := "Picture Clip Application"
  154.     .Move(4035, 1860, 5055, 6840)
  155.     .SampleDir := "C:\Envelop\arsenal\parts\pictclip\"
  156.     .SampleName := "pictclip"
  157.     With .sbrNavigator
  158.       .Caption := "sbrNavigator"
  159.       .ZOrder := 2
  160.       .Move(300, 4950, 4350, 300)
  161.       .SmallChange := 1
  162.       .LargeChange := 3
  163.       .Min := 1
  164.       .Max := 156
  165.       .Value := 1
  166.       .Orientation := "Horizontal"
  167.       .Move(300, 4950, 4350, 300)
  168.     End With  'PictClipMasterForm.sbrNavigator
  169.     With .Label1
  170.       .Caption := "Cropped Area:"
  171.       .ZOrder := 3
  172.       .Move(1500, 5595, 1410, 300)
  173.     End With  'PictClipMasterForm.Label1
  174.     With .imgCropDisplay
  175.       .Caption := "imgCropDisplay"
  176.       .ZOrder := 4
  177.       .Move(3165, 5550, 375, 345)
  178.       .BevelOuter := "None"
  179.       .AutoInitCropRect := False
  180.       .Picture := PictClipMasterForm.bmpIcons
  181.       .ResizeMode := "Clip"
  182.       .ScrollBars := "Never"
  183.       .ScaleX := 1
  184.       .ScaleY := 1
  185.     End With  'PictClipMasterForm.imgCropDisplay
  186.     With .imgFullDisplay
  187.       .Caption := "imgFullDisplay"
  188.       .ZOrder := 5
  189.       .Move(300, 315, 4350, 4365)
  190.       .BevelOuter := "None"
  191.       .Picture := PictClipMasterForm.bmpIcons
  192.     End With  'PictClipMasterForm.imgFullDisplay
  193.     With .bmpIcons
  194.       .LoadType := "MemoryBased"
  195.       .FileName := "pictclip.ero"
  196.       .ResId := 0
  197.     End With  'PictClipMasterForm.bmpIcons
  198.     With .picOutline
  199.       .Caption := "picOutline"
  200.       .ZOrder := 1
  201.       .Move(240, 255, 480, 450)
  202.       .BevelInner := "Raised"
  203.       .BevelWidth := 4
  204.     End With  'PictClipMasterForm.picOutline
  205.     With .helpfile
  206.       .FileName := "C:\Envelop\arsenal\parts\pictclip\pictclip.hlp"
  207.     End With  'PictClipMasterForm.helpfile
  208.   End With  'PictClipMasterForm
  209. End Code
  210.